package dao

import "study/model"

var DynastyDao dynastyDao = dynastyDao{}

type dynastyDao struct {
}

func (this dynastyDao) Add(dynasty *model.Dynasty) {
	Db.Table("dynasty").Create(dynasty)
}

func (this dynastyDao) IsExistByName(name string) bool {
	dynasty := model.Dynasty{}
	Db.Where("name = ?", name).First(&dynasty)
	if dynasty.Name == "" {
		return false
	}
	return true
}
